package io.sdl.config;

import org.springframework.cloud.gateway.filter.ratelimit.KeyResolver;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import reactor.core.publisher.Mono;

@Configuration
public class GatewayConfig {

	@Bean
	public KeyResolver pathKeyResolver() {
		// 根据请求路径限流（例如：/api/users/1 和 /api/orders/2 视为不同的限流key）
		return exchange -> Mono.just(exchange.getRequest().getPath().value());
	}
}